//
//  MVTableViewCell.m
//  Coco_Music
//
//  Created by K。 on 15/6/20.
//  Copyright (c) 2015年 寇广超. All rights reserved.
//
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#import "MVTableViewCell.h"

@implementation MVTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setSelectionStyle:UITableViewCellSelectionStyleNone];

        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    self.titileLabel =[[UILabel alloc]initWithFrame:CGRectMake(10, 5, 50, 50)];
    self.titileLabel.font=[UIFont systemFontOfSize:20];
    self.titileLabel.shadowColor = [UIColor colorWithRed:244.0f/255.0f green:147.0f/255.0f blue:23.0f/255.0f alpha:1.0f];
    [self addSubview:self.titileLabel];
    [_titileLabel release];
    
    self.descLabel =[[UILabel alloc]initWithFrame:CGRectMake(self.titileLabel.frame.origin.x+self.titileLabel.frame.size.width, self.titileLabel.frame.origin.y, [UIScreen mainScreen].bounds.size.width - 70, 30)];
    self.descLabel.shadowColor = [UIColor colorWithRed:244.0f/255.0f green:147.0f/255.0f blue:23.0f/255.0f alpha:1.0f];
    [self addSubview:self.descLabel];
    [_descLabel release];
    
    
    
    self.tagNameLabel =[[UILabel alloc]initWithFrame:CGRectMake(self.titileLabel.frame.origin.x+self.titileLabel.frame.size.width+10, self.descLabel.frame.size.height+self.descLabel.frame.origin.y,[UIScreen mainScreen].bounds.size.height/6, 20)];
    self.tagNameLabel.font =[UIFont systemFontOfSize:13];
    self.tagNameLabel.shadowColor = [UIColor colorWithRed:244.0f/255.0f green:147.0f/255.0f blue:23.0f/255.0f alpha:1.0f];
    [self addSubview:self.tagNameLabel];
    [_tagNameLabel release];
    
    
    
//    
//    self.tagColorLabel =[[UILabel alloc]initWithFrame:CGRectMake(self.tagNameLabel.frame.size.width+self.tagNameLabel.frame.origin.x, self.tagNameLabel.frame.origin.y,[UIScreen mainScreen].bounds.size.height/3, 20)];
//    self.tagColorLabel.shadowColor = [UIColor colorWithRed:244.0f/255.0f green:147.0f/255.0f blue:23.0f/255.0f alpha:1.0f];
//    self.tagColorLabel.font =[UIFont systemFontOfSize:13];
//    [self addSubview:self.tagColorLabel];
//    [_tagColorLabel release];
    
    self.mvImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, self.tagNameLabel.frame.size.height+self.tagNameLabel.frame.origin.y, [UIScreen mainScreen].bounds.size.width - 10, [UIScreen mainScreen].bounds.size.height*2/7)];
    
    [self addSubview:self.mvImageView];
   
    self.mvImageView.layer.masksToBounds =YES;
    self.mvImageView.layer.cornerRadius = 20;
    self.mvImageView.layer.borderWidth = 1;
    self.mvImageView.layer.borderColor =[UIColor blackColor].CGColor;

     [_mvImageView release];
    
    
    
    
//    UIImageView *imageView1 =[[UIImageView alloc]initWithFrame:CGRectMake(self.titileLabel.frame.origin.x, self.mvImageView.frame.size.height+self.mvImageView.frame.origin.y+2, [UIScreen mainScreen].bounds.size.width - 10, 1)];
//    imageView1.backgroundColor =[UIColor cyanColor];
//    [self addSubview:imageView1];
//    [imageView1 release];
    
    
    
}
-(void)setMv:(MV *)mv
{
    if (_mv != mv) {
        [_mv release];
        _mv =  [mv retain];
    }
    self.titileLabel.text =mv.title;
    self.descLabel.text =mv.desc;
    self.tagNameLabel.text = mv.tagName;
    
    NSURL *url =[NSURL URLWithString:mv.bigPicUrl];
    [self.mvImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"11082812,3360,2100"]];
   
    
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
